/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Controller;

import Model.BD.DAO;
import Model.Empresa;
import com.icesoft.faces.component.jsfcl.data.DefaultSelectionItems;
import java.util.List;
import javax.faces.model.SelectItem;

/**
 *
 * @author BBG
 */
public class EmpresaBO
{
    public DAO<Empresa> getDAO() {
          return new DAO <Empresa>(Empresa.class);
    }

    public DefaultSelectionItems montaLista(List <Empresa> lista)
    {
        DefaultSelectionItems itens = new DefaultSelectionItems();
        itens.clear();
        int i=0;
        
        while(i<lista.size())
         {
            itens.add(new SelectItem(lista.get(i).getCodEmpresa(),lista.get(i).getNome()));
            i++;
         }
        return itens;
    }
    public DefaultSelectionItems montaListaNome(List <Empresa> lista)
    {
        DefaultSelectionItems itens = new DefaultSelectionItems();
        itens.clear();
        int i=0;

        while(i<lista.size())
         {
            itens.add(new SelectItem(lista.get(i).getCodEmpresa(),lista.get(i).getNome()));
            i++;
         }
        return itens;
    }
}
